package com.nursinghome.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.nursinghome.group.ElderlyUpdateGroup;
import com.nursinghome.group.ElderlyUpdateGroupByAdmin;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Elderly {
    private Long eid;//老人ID
    @NotBlank(message = "姓名不为空", groups = ElderlyUpdateGroupByAdmin.class)
    private String ename;//老人姓名
    @NotBlank(message = "用户名不为空")
    @Length(min = 5,max = 12,message = "用户名为5-12位", groups = ElderlyUpdateGroupByAdmin.class)
    private String eusername;//老人用户名
    @NotBlank(message = "密码不能为空")
    @Length(min = 5,max = 12,message = "密码长度为5-12位")
    private String epassword;//老人密码
    @NotBlank(message = "性别不能为空" ,groups = ElderlyUpdateGroupByAdmin.class)
    private String egender;//老人性别
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @NotNull(message = "出生日期不能为空",groups = ElderlyUpdateGroupByAdmin.class)
    private Date dateBirth;//出生日期
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @NotNull(message = "入住日期不能为空",groups = ElderlyUpdateGroupByAdmin.class)
    private Date checkDate;//入住日期
    @NotBlank
    @Pattern(regexp = "^[1-9]\\d{16}[0-9X]$", message = "身份证格式不正确",groups = ElderlyUpdateGroupByAdmin.class)
    private String idCard;//身份证
    @NotBlank
    @Length(max = 11, min =5, message = "手机号长度5—11位",  groups = ElderlyUpdateGroup.class)
    private String emergencyContact;//紧急联系人电话
    @NotBlank(message = "头像不能为空", groups = ElderlyUpdateGroup.class)
    private String picdir;//老人图片路径
    @DecimalMax(value = "2")
    private Integer estate;//老人状态
    @NotBlank
    @Length(max = 11, min =5, message = "手机号长度5—11位",  groups = ElderlyUpdateGroup.class)
    private String phone;//老人手机号
    private Integer rid;//房间号
    private List<MedicalStaff> medicalStaffs;//给老人分配护工
    private Room room;//老人所在的房间号
}
